package com.cdd.servicebankcard.controller;

import com.cdd.servicebankcard.model.AccountInfo;
import com.cdd.servicebankcard.service.AccountService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Description TODO
 * @Author: cdd
 * @Date: 2020/7/9 15:30
 * @Version: 1.0
 */
@RestController
public class AccountController {

    @Resource
    private AccountService accountService;

    @GetMapping("/getById")
    public Object getById(Long id){
        return accountService.getById(id);
    }

    @GetMapping("/income/{amount}")
    public String income(@PathVariable Integer amount){
        int rs = accountService.updateAccountById(amount);
        if(rs == 1){
            return "银行卡入账更新成功";
        }else {
            return "银行卡入账失败";
        }
    }
}
